package com.ego.order.controller;

import java.util.Arrays;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.ego.order.po.OrderReturnReason;
import com.ego.order.service.OrderReturnReasonService;
import com.ego.common.util.Result;

/**
 * @program: ego
 * @description 退货原因控制器
 * @author KamTang
 * @date 2022-11-13 11:25:07
 */
@RestController
@RequestMapping("order/orderreturnreason")
public class OrderReturnReasonController {

    @Autowired
    private OrderReturnReasonService orderReturnReasonService;

    /**
     * 信息
     */
    @GetMapping("/get/{id}")
    public Result get(@PathVariable("id") Long id){
		OrderReturnReason orderReturnReason = orderReturnReasonService.getById(id);
        return Result.ok().put("orderReturnReason", orderReturnReason);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    public Result save(@RequestBody OrderReturnReason orderReturnReason){
		orderReturnReasonService.save(orderReturnReason);
        return Result.ok();
    }

    /**
     * 修改
     */
    @PostMapping("/update")
    public Result update(@RequestBody OrderReturnReason orderReturnReason){
		orderReturnReasonService.updateById(orderReturnReason);
        return Result.ok();
    }

    /**
     * 删除
     */
    @PostMapping("/delete")
    public Result delete(@RequestBody Long[] ids){
		orderReturnReasonService.removeByIds(Arrays.asList(ids));
        return Result.ok();
    }

}
